<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改患者</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script src="../../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>


</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form" action="" lay-filter="example">
            <input name="id" type="hidden" class="layui-input">
            <div class="layui-form-item">
                <label class="layui-form-label">姓名：</label>
                <div class="layui-input-block">
                    <input name="name" lay-verify="title" class="layui-input" placeholder="请输入姓名">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">身份证号</label>
                <div class="layui-input-block">
                    <input name="card" lay-verify="title" class="layui-input" placeholder="身份证号">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="sex" value="男" title="男" checked="">
                    <input type="radio" name="sex" value="女" title="女">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">年龄</label>
                <div class="layui-input-block">
                    <input name="age" lay-verify="title" class="layui-input" placeholder="请输入年龄">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">科室</label>
                <div class="layui-input-block">
                    <input name="deid" lay-verify="title" class="layui-input" placeholder="请输入科室id">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">医生</label>
                <div class="layui-input-block">
                    <input name="doid" lay-verify="title" class="layui-input" placeholder="请输入医生id">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">余额：</label>
                <div class="layui-input-block">
                    <input name="money" lay-verify="title" class="layui-input" placeholder="请输入病人余额">
                </div>
             </div>
            <div class="layui-form-item">
                <label class="layui-form-label">挂号类型</label>
                <div class="layui-input-block">
                    <input name="retypeid" lay-verify="title" class="layui-input" placeholder="请输入类型1是专家2是普通">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="demo1">修改挂号</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>


<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
        layui.use(['form','laydate'], function () {
        var form = layui.form
        , layer = layui.layer
        , laydate = layui.laydate;
        //日期
        laydate.render({
        elem: '#date'
    });
        //监听提交
        form.on('submit(demo1)', function (data) {
            console.log("hahaha")
        //ajax 调用接口
        $.post("/api/register/update.do",data.field,function(res){
        if(res.code==200){
        //修改成功
        layer.msg('修改成功！');
        //关闭当前页面
            var iframeIndex = parent.layer.getFrameIndex(window.name);
            parent.layer.close(iframeIndex);
            location.href = "RegisterList.html"
    }else{
        //新增失败
        layer.msg('修改失败！');
    }
    });
        return false;
    });
        //获取要编辑的内容
        var json=localStorage.getItem("register");
        console.log(json);
        //表单初始赋值
        form.val('example',eval("("+json+")"));
    });
</script>


</body>
</html>